how to find duplicate character in string in java using for loop